<!doctype html>
<html lang="en">

<head>
  <!-- Required meta tags -->
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

  <!-- CSS -->
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
  <link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.15.1/css/all.css" integrity="sha384-9ZfPnbegQSumzaE7mks2IYgHoayLtuto3AS6ieArECeaR8nCfliJVuLh/GaQ1gyM" crossorigin="anonymous">
  <link rel="stylesheet" href="roboto/css/roboto.css">
  <link rel="stylesheet" href="styles.css">
  <script src="main.js"></script>

  <!-- Favicon -->
  <link rel="icon" type="image/png" sizes="192x192" href="/assets/android-icon-192x192.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/assets/favicon-32x32.png">
  <link rel="icon" type="image/png" sizes="96x96" href="/assets/favicon-96x96.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/assets/favicon-16x16.png">

  <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/styles/default.min.css">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/highlight.min.js" integrity="sha512-XJ+kBRoBFQps17m1/oCbbESEJtXMrCKq6Ls2a9MKSwoQsSrUk8i+qOd/7YXfl3BsAlfjUyQ4EPd0b0JB24Bgwg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
  <script>hljs.initHighlightingOnLoad();</script>

  <title>systeminformation</title>

</head>

<body>
  <nav class="nav">
    <div class="container">
      <a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
        <div class="title float-left">systeminformation</div>
      </a>
      <div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>
      <div class="text float-right todocs"><a href="./#docs">Docs Overview</a></div>
    </div>
  </nav>

  <div class="container-fluid">
    <section class="container">
      <div class="row">
        <div class="col-12 col-md-4 col-lg-3 col-xl-2 menu" id="menu">
        </div>
        <div class="col-12 col-md-8 col-lg-9 col-xl-10 content">
          <div class="row">
            <div class="col-12 sectionheader">
              <div class="title">Processes and Services</div>
              <div class="text">
                <p>In this section you will learn how to get information about current load, running processes and installed services:</p>
                <p>For function reference and examples we assume, that we imported <span class="code">systeminformation</span> as follows:</p>
                <pre><code class="js">const si = require('systeminformation');</code></pre>
                <h2>Current Load, Processes, Services</h2>
                <p>All functions in this section return a promise or can be called with a callback function (parameter <span class="code">cb</span> in the function reference)</p>
                <table class="table table-sm table-bordered table-striped">
                  <thead>
                    <tr>
                      <th>Function</th>
                      <th>Result object</th>
                      <th>Linux</th>
                      <th>BSD</th>
                      <th>Mac</th>
                      <th>Win</th>
                      <th>Sun</th>
                      <th>Comments</th>
                    </tr>
                  </thead>
                  <tr>
                    <td>si.currentLoad(cb)</td>
                    <td>{...}</td>
                    <td>X</td>
                    <td></td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>CPU-Load</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>avgLoad</td>
                    <td>X</td>
                    <td></td>
                    <td>X</td>
                    <td></td>
                    <td>X</td>
                    <td>average load</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>currentLoad</td>
                    <td>X</td>
                    <td></td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>CPU load in %</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>currentLoadUser</td>
                    <td>X</td>
                    <td></td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>CPU load user in %</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>currentLoadSystem</td>
                    <td>X</td>
                    <td></td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>CPU load system in %</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>currentLoadNice</td>
                    <td>X</td>
                    <td></td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>CPU load nice in %</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>currentLoadIdle</td>
                    <td>X</td>
                    <td></td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>CPU load idle in %</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>currentLoadIrq</td>
                    <td>X</td>
                    <td></td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>CPU load hardware interrupts in %</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>currentLoadSteal</td>
                    <td>X</td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td>Time stolen by other OS running in VMs in %</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>currentLoadGuest</td>
                    <td>X</td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td>Time spent for running virtual CPU in %</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>rawCurrentLoad...</td>
                    <td>X</td>
                    <td></td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>CPU load raw values (ticks)</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>cpus[]</td>
                    <td>X</td>
                    <td></td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>current loads per CPU in % + raw ticks</td>
                  </tr>
                  <tr class="example">
                    <td></td>
                    <td colspan="7">
                      <h5>Example</h5>
                      <pre><code class="js">const si = require('systeminformation');
si.currentLoad().then(data => console.log(data));</code></pre>
                      <pre class="example">
{
  avgLoad: 0.23,
  currentLoad: 4.326328800988875,
  currentLoadUser: 2.595797280593325,
  currentLoadSystem: 1.73053152039555,
  currentLoadNice: 0,
  currentLoadIdle: 95.67367119901112,
  currentLoadIrq: 0,
  rawCurrentLoad: 350,
  rawCurrentLoadUser: 210,
  rawCurrentLoadSystem: 140,
  rawCurrentLoadNice: 0,
  rawCurrentLoadIdle: 7740,
  rawCurrentLoadIrq: 0,
  rawCurrentLoadSteal: 0,
  rawCurrentLoadGuest: 0,
  cpus: [
    {
      load: 13.725490196078432,
      loadUser: 7.8431372549019605,
      loadSystem: 5.88235294117647,
      loadNice: 0,
      loadIdle: 86.27450980392157,
      loadIrq: 0,
      loadSteal: 0,
      loadGuest: 0,
      rawLoad: 140,
      rawLoadUser: 80,
      rawLoadSystem: 60,
      rawLoadNice: 0,
      rawLoadIdle: 880,
      rawLoadIrq: 0
      rawLoadSteal: 0
      rawLoadGuest: 0
    },
    ...
  ]
}</pre>
                    </td>
                  </tr>
                  <tr>
                    <td>si.fullLoad(cb)</td>
                    <td>: integer</td>
                    <td>X</td>
                    <td></td>
                    <td>X</td>
                    <td>X</td>
                    <td></td>
                    <td>CPU full load since bootup in %</td>
                  </tr>
                  <tr>
                    <td>si.processes(cb)</td>
                    <td>{...}</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td># running processes</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>all</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td># of all processes</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>running</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td></td>
                    <td>X</td>
                    <td># of all processes running</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>blocked</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td></td>
                    <td>X</td>
                    <td># of all processes blocked</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>sleeping</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td></td>
                    <td>X</td>
                    <td># of all processes sleeping</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>unknown</td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td>X</td>
                    <td></td>
                    <td># of all processes unknown status</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>list[]</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>list of all processes incl. details</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>...[0].pid</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>process PID</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>...[0].parentPid</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>parent process PID</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>...[0].name</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>process name</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>...[0].cpu</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>process % CPU usage</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>...[0].cpuu</td>
                    <td>X</td>
                    <td>X</td>
                    <td></td>
                    <td>X</td>
                    <td></td>
                    <td>process % CPU usage (user)</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>...[0].cpus</td>
                    <td>X</td>
                    <td>X</td>
                    <td></td>
                    <td>X</td>
                    <td></td>
                    <td>process % CPU usage (system)</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>...[0].mem</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>process memory %</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>...[0].priority</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>process priority</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>...[0].memVsz</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>process virtual memory size</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>...[0].memRss</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>process mem resident set size</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>...[0].nice</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td></td>
                    <td>X</td>
                    <td>process nice value</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>...[0].started</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>process start time</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>...[0].state</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>process state (e.g. sleeping)</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>...[0].tty</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td></td>
                    <td>X</td>
                    <td>tty from which process was started</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>...[0].user</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td></td>
                    <td>X</td>
                    <td>user who started process</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>...[0].command</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>process starting command</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>...[0].params</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td></td>
                    <td>X</td>
                    <td>process params</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>...[0].path</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>process path</td>
                  </tr>
                  <tr class="example">
                    <td></td>
                    <td colspan="7">
                      <h5>Example</h5>
                      <pre><code class="js">const si = require('systeminformation');
si.processes().then(data => console.log(data));</code></pre>
                      <pre class="example">
{
  all: 258,
  running: 1,
  blocked: 0,
  sleeping: 157,
  unknown: 0,
  list: [
    {
      pid: 1,
      parentPid: 0,
      name: 'init',
      cpu: 0.04504576931569955,
      cpuu: 0.04084113255431208,
      cpus: 0.00420463676138747,
      mem: 0,
      priority: 19,
      memVsz: 166144,
      memRss: 10684,
      nice: 0,
      started: '2020-02-08 10:18:15',
      state: 'sleeping',
      tty: '',
      user: 'root',
      command: 'init',
      params: '',
      path: '/sbin'
    },
    ...
  ]
}</pre>
                    </td>
                  </tr>
                  <tr>
                    <td>si.processLoad('nginx, ssl',cb)</td>
                    <td>[{...}]</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td></td>
                    <td>detailed information about given processes<br>pass comma separated list or<br>'*' for all processes</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>[0].proc</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td></td>
                    <td>process name</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>[0].pid</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td></td>
                    <td>PID</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>[0].pids</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td></td>
                    <td>additional pids</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>[0].cpu</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td></td>
                    <td>process % CPU</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>[0].mem</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td></td>
                    <td>process % MEM</td>
                  </tr>
                  <tr class="example">
                    <td></td>
                    <td colspan="7">
                      <h5>Example</h5>
                      <pre><code class="js">const si = require('systeminformation');
si.processLoad('nginx, postgres').then(data => console.log(data));</code></pre>
                      <pre class="example">
[
{
  proc: 'nginx',
  pid: 11267,
  pids: [
    11251, 11252, 11253,
    11254, 11255, 11256,
    11257, 11258, 11259,
    11260, 11261, 11262,
    11263, 11264, 11265,
    11266, 11267
  ],
  cpu: 0.01,
  mem: 0
},
  {
    proc: 'postgres',
    pid: 1435,
    pids: [
      1435, 1513, 1545,
      1546, 1547, 1548,
      1549, 1550
    ],
    cpu: 0.01,
    mem: 0
  },
]</pre>
                    </td>
                  </tr>
                  <tr>
                    <td>si.services('mysql, apache2', cb)</td>
                    <td>[{...}]</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td></td>
                    <td>pass comma separated string of services<br />pass &quot;*&quot; for ALL services (linux/win only)</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>[0].name</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td></td>
                    <td>name of service</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>[0].running</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td></td>
                    <td>true / false</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>[0].startmode</td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td>X</td>
                    <td></td>
                    <td>manual, automatic, ...</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>[0].pids</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td></td>
                    <td></td>
                    <td>pids</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>[0].cpu</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td></td>
                    <td></td>
                    <td>process % CPU</td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>[0].mem</td>
                    <td>X</td>
                    <td>X</td>
                    <td>X</td>
                    <td></td>
                    <td></td>
                    <td>process % MEM</td>
                  </tr>
                  <tr class="example">
                    <td></td>
                    <td colspan="7">
                      <h5>Example</h5>
                      <pre><code class="js">const si = require('systeminformation');
si.services('mysql, postgres').then(data => console.log(data));</code></pre>
                      <pre class="example">
[
  {
    name: 'mysql',
    running: true,
    startmode: '',
    pids: [ 152 ],
    cpu: 0.3,
    mem: 0
  },
  {
    name: 'postgres',
    running: true,
    startmode: '',
    pids: [ 1087, 1873 ],
    cpu: 0,
    mem: 0
  },
]</pre>
                    </td>
                  </tr>
                </table>
                <h4>Getting correct stats values</h4>

                <p>In <span class="code">currentLoad()</span> the
                  results are calculated correctly beginning with the <strong>second</strong> call of the function.
                  It is determined by calculating the difference of cpu ticks between two calls of the function.</p>

                <p>The first time you are calling one of this functions, you will get the load since cpu uptime.
                  The second time, you should then get statistics based on cpu ticks between the two calls ...</p>

                <p>So basically, your code should look like this:</p>

                <pre><code class="js">const si = require('systeminformation');

              setInterval(function() {
                  si.currentLoad().then(data => {
                      console.log(data);
                  })
              }, 1000)</code></pre>
                <p>Beginning with the second call, you get precise load values between the two calls.</p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  </div>
  <footer class="container-fluid footer">
    <div class="container">
      <div class="row">
        <div class="col-lg-4 col-12">
          <ul class="list-unstyled">
            <li><a href="." class="medium home">Home</a></li>
            <li>&nbsp;</li>
            <li><a href="security.html">Security Advisories&nbsp;&nbsp;<i class="fas fa-shield-check"></i></a></li>
            <li><a href="https://github.com/sebhildebrandt/systeminformation">Github <i class="fab fa-github"></i></a></li>
            <li>&nbsp;</li>
            <li><a href="https://buymeacoff.ee/systeminfo" class="medium badge bg-primary"><i class="fas fa-coffee"></i>&nbsp;&nbsp;Buy me a coffee</a></li>
          </ul>
        </div>
        <div class="col-lg-4 col-12">
          <ul class="list-unstyled">
            <li><a href="gettingstarted.html">Quick Start</a></li>
            <li><a href="changes.html">Version 5 Changes</a></li>
            <li><a href="history.html">Full Version History</a></li>
            <li><a href="tests.html">Testing</a></li>
            <li><a href="issues.html">Known Issues</a></li>
            <li><a href="statsfunctions.html">Stats Functions</a></li>
          </ul>
        </div>
        <div class="col-lg-4 col-12">
          <ul class="list-unstyled">
            <li><a href="contributors.html">Contributors</a></li>
            <li><a href="trademarks.html">Trademarks</a></li>
            <li>&nbsp;</li>
            <li><a href="copyright.html">Copyright &amp; License&nbsp;&nbsp;<img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
            <li><a href="https://www.plus-innovations.com">&copy; 2025 Sebastian Hildebrandt</a></li>
            <li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
          </ul>
        </div>
      </div>
    </div>
  </footer>

  <script>
    window.onload = function (e) {
      createMenu();
    }
  </script>
</body>

</html>
